import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import { AlertController } from 'ionic-angular';
/**
 * Generated class for the MerBuyAgentStoreListPage page.
 *
 * See https://ionicframework.com/docs/components/#navigation for more info on
 * Ionic pages and navigation.
 */

@IonicPage()
@Component({
  selector: 'page-mer-buy-agent-store-list',
  templateUrl: 'mer-buy-agent-store-list.html',
})
export class MerBuyAgentStoreListPage {
  msg:string='';
  which:string='market';
  marketCards=[
    {id:'01',name:'家乐福(云纺路店)',src:'assets/imgs/market/cs1.png',phone:'18213963038',addr:'丽江市古城区光义街官院巷',sumAgent:'50',isAgent:false},
    {id:'02',name:'百慕大购物广场',src:'assets/imgs/market/cs3.png',phone:'18213963038',addr:'丽江市古城区光义街官院巷',sumAgent:'80',isAgent:false},
    {id:'03',name:'沃尔玛(国贸路店)',src:'assets/imgs/market/cs4.png',phone:'18213963038',addr:'丽江市古城区光义街官院巷',sumAgent:'560',isAgent:false},
    {id:'04',name:'华润万家(万达广场店)',src:'assets/imgs/market/cs5.png',phone:'18213963038',addr:'丽江市古城区光义街官院巷',sumAgent:'150',isAgent:false},
    {id:'05',name:'三叶百货',src:'assets/imgs/market/cs6.png',phone:'18213963038',addr:'丽江市古城区光义街官院巷',sumAgent:'90',isAgent:false}
  ];
  foodCards=[
    {id:'01',name:'建新园(永平店)',src:'assets/imgs/myfav/jianxinyuan.jpg',phone:'18213963038',addr:'丽江市古城区光义街官院巷',sumAgent:'350'},
    {id:'02',name:'老滇过桥米线(永安路)',src:'assets/imgs/myfav/mixian1.jpg',phone:'18213963038',addr:'丽江市古城区光义街官院巷',sumAgent:'80'},
    {id:'03',name:'德克士(昆明站店)',src:'assets/imgs/myfav/dic.jpg',phone:'18213963038',addr:'丽江市古城区光义街官院巷',sumAgent:'560'},
    {id:'04',name:'麦当劳(春城得来速店)',src:'assets/imgs/myfav/mcd.jpg',phone:'18213963038',addr:'丽江市古城区光义街官院巷',sumAgent:'150'}
  ];
  hotelCards=[
    {id:'01',name:'燕栖四合民宿客栈',src:'assets/imgs/myfav/hotel.jpg',phone:'18213963038',addr:'丽江市古城区光义街官院巷',sumAgent:'350'},
    {id:'02',name:'宝月精舍Homestay',src:'assets/imgs/myfav/hotel1.jpg',phone:'18213963038',addr:'丽江市古城区光义街官院巷',sumAgent:'80'},
    {id:'03',name:'A＆R House',src:'assets/imgs/myfav/hotel2.jpg',phone:'18213963038',addr:'丽江市古城区光义街官院巷',sumAgent:'560'},
    {id:'04',name:'昆明蘑菇实验室文艺民宿',src:'assets/imgs/myfav/hotel3.jpg',phone:'18213963038',addr:'丽江市古城区光义街官院巷',sumAgent:'150'},
    {id:'04',name:'jojo的民宿小屋',src:'assets/imgs/myfav/hotel4.jpg',phone:'18213963038',addr:'丽江市古城区光义街官院巷',sumAgent:'150'}
  ];
  merTicketCards=[
    {id:'01',name:'丽江宋城旅游公司',src:'assets/imgs/agent/lijiangticket.jpg',phone:'18213963038',addr:'丽江市古城区光义街官院巷',sumAgent:'350'},
    {id:'02',name:'丽江古城旅游公司',src:'assets/imgs/agent/qianguchengticket.png',phone:'18213963038',addr:'丽江市古城区光义街官院巷',sumAgent:'80'},
    {id:'03',name:'束河古镇旅游公司',src:'assets/imgs/agent/biaoyanticket.png',phone:'18213963038',addr:'丽江市古城区光义街官院巷',sumAgent:'560'}
  ];
  ticketCards=[
    {id:'01',name:'丽江木府+万古楼',src:'assets/imgs/agent/lijiangticket.jpg',phone:'18213963038',addr:'丽江市古城区光义街官院巷',sumAgent:'350'},
    {id:'02',name:'丽江千古情演出票（19：00场次）',src:'assets/imgs/agent/qianguchengticket.png',phone:'18213963038',addr:'丽江市古城区光义街官院巷',sumAgent:'80'},
    {id:'03',name:'印象丽江表演',src:'assets/imgs/agent/biaoyanticket.png',phone:'18213963038',addr:'丽江市古城区光义街官院巷',sumAgent:'560'}
  ];
  constructor(public navCtrl: NavController, public navParams: NavParams,public alertCtrl: AlertController) {
  }
  forPage(item,whichone){
    // if(whichone===""){
    //   // this.appconfig.presentToast('暂停服务中，敬请期待...');
    // }else{
    //   // this.appconfig.presentToast('正在前往'+item.name+'的途中...');
    //   this.navCtrl.push("MerBuyAgentGoodsListPage",{"data":item,"whichone":whichone});
    // }
    this.navCtrl.push("MerBuyAgentGoodsListPage",{"data":item,"whichone":whichone});

  }

  /*agentAll(tmp,i,whichone) {
    if(!tmp.isAgent)
      this.msg='确定';
    else this.msg='取消';
    let confirm = this.alertCtrl.create({
      title: tmp.name,
      message:  this.msg+'代理他家所有商品么？',
      buttons: [
        {
          text: '取消',
          handler: () => {
            console.log('Disagree clicked');
          }
        },
        {
          text: '确定',
          handler: () => {
            if(whichone==='market'){
              if(tmp.isAgent){
                tmp.sumAgent--;
              }else {
                tmp.sumAgent++;
              }
              tmp.isAgent = !tmp.isAgent;
            }

            if(whichone==='food'){
              if(tmp.isAgent){
                tmp.sumAgent--;
              }else {
                tmp.sumAgent++;
              }
              tmp.isAgent = !tmp.isAgent;
            }
            if(whichone==='hotel'){
              if(tmp.isAgent){
                tmp.sumAgent--;
              }else {
                tmp.sumAgent++;
              }
              tmp.isAgent = !tmp.isAgent;
            }
            if(whichone==='ticket'){
              if(tmp.isAgent){
                tmp.sumAgent--;
              }else {
                tmp.sumAgent++;
              }
              tmp.isAgent = !tmp.isAgent;
            };
          }
        }
      ]
    });
    confirm.present();
  }*/

  ionViewDidLoad() {
    console.log('ionViewDidLoad MerBuyAgentStoreListPage');
  }

}
